package com.unionpay.upyzt.model;

import com.unionpay.upyzt.exception.UpyztException;
import com.unionpay.upyzt.net.APIResource;
import com.unionpay.upyzt.net.RequestOptions;
import com.unionpay.upyzt.resp.WithdrawalConfirmResp;
import java.util.Map;
import lombok.experimental.Accessors;

@Accessors(chain = true)
public class WithdrawalConfirm extends APIResource {

    /**
     * 批量提现确认
     *
     * @param params    请求参数
     * @return 返回参数
     * @throws UpyztException 异常
     */
    public static WithdrawalConfirmResp confirm(Map<String, Object> params) throws UpyztException {
        return confirm(params, null);
    }

    /**
     * 批量提现确认
     *
     * @param params    请求参数
     * @param options   参数选项
     * @return 返回参数
     * @throws UpyztException 异常
     */
    public static WithdrawalConfirmResp confirm(Map<String, Object> params, RequestOptions options) throws UpyztException {
        return APIResource.request(RequestMethod.POST,
            classURL(WithdrawalConfirm.class), params,
            WithdrawalConfirmResp.class, options);
    }

    /**
     * 提现确认状态查询
     *
     * @param outBatchOrderNo 批量提现平台批次号
     * @return 返回参数
     * @throws UpyztException 异常
     */
    public static WithdrawalConfirmResp retrieveConfirmByBatchOutOrderNo(String outBatchOrderNo) throws UpyztException {
        return APIResource.request(RequestMethod.GET,
            instanceURL(WithdrawalConfirm.class, "_by_out_batch_order_no", outBatchOrderNo), null,
            WithdrawalConfirmResp.class, null);
    }

}
